//------------------------------------------------------------------------------------------------------------
//	timer class
//------------------------------------------------------------------------------------------------------------

#ifndef TIMER_HPP
#define TIMER_HPP
#include <windows.h>

class TIMER
{
	public:
		TIMER()
		{
			LARGE_INTEGER	i;
			counter.QuadPart = 0;
			QueryPerformanceFrequency(&i);
			standardResolution = 1.0f/((f32)i.QuadPart);
			SetResolution(1);
		}

		void	SetResolution( f32 seconds )
		{
			if( seconds!=0 )
				resolutionMultiplier = standardResolution/seconds;
		}

		float	GetResolution( )
		{
			return standardResolution/resolutionMultiplier;
		}

		float	GetTime()
		{
			QueryPerformanceCounter(&counter);
			return counter.QuadPart*resolutionMultiplier;
		}

		float	GetTimeElapsed()
		{
			LARGE_INTEGER oldc = counter;
			QueryPerformanceCounter(&counter);
			return ((f32)(counter.QuadPart - oldc.QuadPart))*resolutionMultiplier;
		}

	protected:

		LARGE_INTEGER	counter;
		f32				standardResolution;
		f32				resolutionMultiplier;
};

#endif // TIMER_HPP